home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 3
/
Info_Mac_1994-01.iso
/
Development
/
General
/
GCC 1.37.1r15
/
Tests
/
tak.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-10
|
341b
|
24 lines
/* Tak in C */
#include "defns.h"
main()
{
int i, starttime = clock();
for (i = 0; i < 10; ++i) tak(18, 12, 6);
printf("%d/%d seconds\n", clock() - starttime, 60);
}
tak(x, y, z)
int x, y, z;
{
if (y >= x) {
return z;
} else {
return (tak(tak(x - 1, y, z),
tak(y - 1, z, x),
tak(z - 1, x, y)));
}
}